package com.itheima.homework.One;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/*需求 :  利用键盘录入，输入一个字符串,统计该字符串中各个字符的数量

        - 如用户输入字符串:"helloworldjava",程序输出结果：
        - h-1 e-1 l-3 o-2 w-1 r-1 d-1 j-1 a-2 v-1   （顺序不做要求）*/
public class Demo {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String next = scanner.next();

        char[] chars = next.toCharArray();

        Map<Character,Integer> map = new HashMap();

        for (int i = 0; i < chars.length; i++) {
            if(map.containsKey(chars[i])){
                Integer it = map.get(chars[i]);
                it++;
                map.put(chars[i],it);

            }else{
                map.put(chars[i],1);
            }

        }

        System.out.println(map);


    }
}
